<?php
/**
 * this class loads the cms skin
 *
 */
class Zend_View_Helper_LoadSkin extends Zend_View_Helper_Abstract
{
    public function loadSkin($skin)
    {
        $fc = Zend_Controller_Front::getInstance ();
        $baseUrl = str_replace ( '/index.php', '', str_replace ( '/index.php/', '', $fc->getBaseUrl () ) );
  
        // load the default config file
        $skinData = new Zend_Config_Xml ( './public/default.xml' );
        $stylesheets = $skinData->stylesheets->stylesheet->toArray ();
        if (is_array ( $stylesheets ))
        {
            foreach ( $stylesheets as $stylesheet )
            {
                $this->view->headLink ()->appendStylesheet ( $baseUrl . "/public/css/" . $stylesheet ['name'], $stylesheet ['media'] );
            }
        }
    }
}
